//程序入口文件
const express = require('express');

//初始化应用
const app = new express();
app.listen('8001','localhost');

//保存用户信息
var session = require("express-session");
//配置中间件  固定格式
app.use(session({
    secret: 'keyboard cat',
    resave: false,
    saveUninitialized: true,
    cookie: {
        maxAge:1000*60*30
    },
    rolling:true
}))

//设置view 引擎为html
var ejs = require('ejs');
app.engine('html',ejs.__express); 
app.set('view engine','html');

//设置静态资源目录
app.use(express.static('static'));
//设置上传文件目录
app.use('/upload',express.static('upload'));

//引入并加载模块
var home = require('./application/home.js');
var admin = require('./application/admin.js');
app.use('/home',home);
app.use('/admin',admin);